package com.example.pro1.service.zhao.table.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.pro1.entity.zhao.Uesr;
import com.example.pro1.mapper.zhao.UserMapper;
import com.example.pro1.service.zhao.table.UsertableService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class UsertableServiceImpl extends ServiceImpl<UserMapper, Uesr> implements UsertableService {

    @Override
    public void updateUserByOpenid(String openid)
    {
        QueryWrapper<Uesr> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("cwxopenId",openid);
        if(baseMapper.selectOne(queryWrapper)==null) //如果没有则存入数据库
        {
            Uesr uesr = new Uesr();
            uesr.setCwxopenid(openid);
            //TODO 插入别的数据
            baseMapper.insert(uesr);
        }
    }
}
